package com.lshl.lingshang;

import androidx.lifecycle.Observer;

import com.lshl.lingshang.base.BaseActivity;
import com.lshl.lingshang.bean.ErrorBean;
import com.lshl.lingshang.databinding.ActivityMainBinding;
import com.lshl.lingshang.http.requestbean.DialogBean;
import com.lshl.lingshang.model.MainModel;
import com.lshl.lingshang.ui.bean.BannerBean;
import com.lshl.lingshang.utils.LogUtil;

public class MainActivity extends BaseActivity<MainModel, ActivityMainBinding> {
    @Override
    protected int getLayoutId() {
        return R.layout.activity_main;
    }


    @Override
    protected void initView() {
        getLifecycle().addObserver(viewModel);
        viewModel.requestImg();
    }

    @Override
    protected void initData() {

        dataBinding.setViewmodel(viewModel);
        viewModel.getNewsList().observe(this, new Observer<BannerBean>() {
            @Override
            public void onChanged(BannerBean bannerBean) {
                LogUtil.showAll("getNewsList====="+bannerBean.toString());
            }
        });
        viewModel.getErrorMsg(this, new Observer<ErrorBean>() {
            @Override
            public void onChanged(ErrorBean errorBean) {
                LogUtil.showAll("getErrorMsg====="+errorBean.toString());
            }
        });

    }

    @Override
    protected void showError(Object obj) {

    }
}